package com.demo.strategy.pay;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author likz
 * @Date 2025/7/24 16:23
 * @Description
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Order {

    private String uid;

    private String orderId;

    private double amount;

    public MsgResult pay()
    {
        return pay(PayStrategy.DEFAULT);
    }

    public MsgResult pay(String payKey)
    {
        Payment payment = PayStrategy.getPayment(payKey);
        System.out.println("欢迎使用" + payment.getName());
        System.out.println("本次交易金额：" + amount);
        return payment.pay(uid, amount);
    }
}
